﻿using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using System.ComponentModel.Composition;

namespace Language.Intellisense.SmartIndent
{
    [Export( typeof( ISmartIndentProvider ) )]
    [Name( "Red Scripts Smart Indentation Provider" )]
    [ContentType( "redscript" )]
    class Provider : ISmartIndentProvider
    {
        #region Imports

        [Import]
        private Language.Utility.Settings _settings = null;

        #endregion Imports

        #region ISmartIndentProvider

        ISmartIndent ISmartIndentProvider.CreateSmartIndent( ITextView textView )
        {
            _settings.Refresh();

            return textView.Properties.GetOrCreateSingletonProperty( () => new Indenter( textView, _settings ) );
        }

        #endregion ISmartIndentProvider
    }
}
